#include-once

#include <GDIPlus.au3>

Global $hMainGUI, $hContext, $hContextGraphics, $hCharmBar, $hCharmGraphic, $hRClickedTile, $hParent

Global Const $iCharmBarWidth = 80

Global Const $iWidthUnit = 144
Global Const $iSpace = 12

Global Const $iMaxTiles = 500
Global Const $iTilesZoneX = 144
Global Const $iTilesZoneY = 144

Func _CreateSettings()
	IniWrite(@ScriptDir & "\settings.ini", "general", "background", "0x660099")
	IniWrite(@ScriptDir & "\settings.ini", "general", "lang", "English.lng")
	IniWrite(@ScriptDir & "\settings.ini", "lockscreen", "background", "0x000000")
	IniWrite(@ScriptDir & "\settings.ini", "lockscreen", "datescheme", "0")
	IniWrite(@ScriptDir & "\settings.ini", "tiles", "1", "")
	_LoadSettings()
EndFunc   ;==>_CreateSettings

Func _LoadSettings()
	Global $Settings_Background = IniRead(@ScriptDir & "\settings.ini", "general", "background", "0x660099")
	Global $Settings_Language = IniRead(@ScriptDir & "\settings.ini", "general", "lang", "English.lng")
	Global $Settings_LS_Background = IniRead(@ScriptDir & "\settings.ini", "lockscreen", "background", "0x000000")
	Global $Settings_LS_DateScheme = IniRead(@ScriptDir & "\settings.ini", "lockscreen", "datescheme", "0")
	Global $Settings_Tiles = IniReadSection(@ScriptDir & "\settings.ini", "tiles")

	Global $hPNG_AddApp = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\add_app.png")
	Global $hPNG_AddExe = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\add_exe.png")
	Global $hPNG_Settings = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\settings.png")
	Global $hPNG_Exit = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\exit.png")
	Global $hPNG_Delete = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\delete.png")
	Global $hPNG_Rename = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\rename.png")
	Global $hPNG_Enlarge = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\enlarge.png")
	Global $hPNG_Restore = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\restore.png")
	Global $hPNG_ChangePic = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\tile_bg.png")
	Global $hPNG_Back = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\back.png")
	Global $hPNG_Desktop = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\desktop.png")
	Global $hPNG_Lockscreen = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\pic\lockscreen.png")
EndFunc   ;==>_LoadSettings

Func _LoadTranslation($sFile)
	Global $aLang[53]
	Local $aSection = IniReadSection(@ScriptDir & "\lang\" & $sFile, "translation")
	For $i = 0 To $aSection[0][0] - 1 Step 1
		$aLang[$i] = $aSection[$i + 1][1]
	Next
EndFunc   ;==>_LoadTranslation

Func _DisposeImg()
	_GDIPlus_ImageDispose($hPNG_AddApp)
	_GDIPlus_ImageDispose($hPNG_AddExe)
	_GDIPlus_ImageDispose($hPNG_Settings)
	_GDIPlus_ImageDispose($hPNG_Exit)
	_GDIPlus_ImageDispose($hPNG_Delete)
	_GDIPlus_ImageDispose($hPNG_Rename)
	_GDIPlus_ImageDispose($hPNG_Enlarge)
	_GDIPlus_ImageDispose($hPNG_Restore)
	_GDIPlus_ImageDispose($hPNG_ChangePic)
EndFunc   ;==>_DisposeImg
